﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="EventDetails.aspx.cs" Inherits="Pages_Public_EventDetails" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageHeader" Runat="Server">
    <script language="javascript" type="text/javascript">
        var _CurrentlyViewingEventID = 0;

        function SendBooking(eventID) {
            _CurrentlyViewingEventID = eventID;
            ShowModalPopup('divModalEventBooking', '', '', true);
        }
        var _EventBooking = null;
        function PopulateBookingObject() {
            _EventBooking = new App.CustomEntity.EventBooking();
            _EventBooking.EventID = _CurrentlyViewingEventID;
            _EventBooking.Email = $('#<%=txtEmail.ClientID %>').val();
            _EventBooking.Name = $('#<%=txtName.ClientID %>').val();
            _EventBooking.Address = $('#<%=txtAddress.ClientID %>').val();
            _EventBooking.ContactNo = $('#<%=txtContactNo.ClientID %>').val();
        }
        function SaveEventBooking() {
            if (Page_ClientValidate('SaveInfo')) {
                //ShowProgressAnimation('btnSave', 0, 25);
                //ShowCenteredProgressAnimation();
                $('#divEventSaveMessage').hide();
                $('#divEventSaveLoading').show();
                PopulateBookingObject();
                PageMethods.SaveEventBooking(_EventBooking, SaveEventBooking_Success, OnAjax_Error, OnAjax_TimeOut);
            }
        }
        function SaveEventBooking_Success(result) {
            //HideProgressAnimation();
            $('#divEventSaveLoading').hide();
            if (result == 1)
                $('#divEventSaveMessage').html('Your Booking Recorded Successfully.').addClass('<%=AppConstants.UI.MESSAGE_BOX_CLASS %>').removeClass('<%=AppConstants.UI.ERROR_MESSAGE_BOX_CLASS %>').fadeIn('slow');
            else if (result == -1) {
                $('#divEventSaveMessage').html('You have already submitted a booking request for this event.').addClass('<%=AppConstants.UI.ERROR_MESSAGE_BOX_CLASS %>').removeClass('<%=AppConstants.UI.MESSAGE_BOX_CLASS %>').fadeIn('slow');
            }
        }
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="PageBody" Runat="Server">
    <h4 id="h4Heading" runat="server">Event Details</h4>    
    <div id="divMessage" runat="server" visible="false" enableviewstate="false"></div>    
    <div class="clearboth"></div>
      
    <asp:Panel ID="pnlFormContainer" runat="server">
        <div id="EventImageFile" runat="server" visible="false" style="margin-bottom:10px;"></div>
        <div class="ListTitle" id="divTitle" runat="server"></div>
        <div class="ListSubTitle" id="divDate" runat="server"></div>
        
        <div style="background:#D3F0B6; margin:5px 0px 5px 0px; padding:4px 10px 4px 10px; font-weight:bold;">Event Details</div>
        <div id="divDescription" runat="server"></div>

        <div style="margin-top:10px;">
            <a onclick="SendBooking(<%=_EventID %>);" href="javascript:void(0);">Send Booking</a>
        </div>
    </asp:Panel>


    <%--Modal Event Booking Form Start --%>
    <div id="divModalEventBooking" class="PopupContainer" style="display: none; width:575px; height:auto;">        
        <div class="PopupBody" style="padding:5px;">            
            <div style="height:250px; overflow:auto;">
                <div class="WizardContainer" style="margin-top:0px;">
                    <div class="StepHeaderContainer">
                        <div class="StepHeading">
                            <asp:Label ID="lblFormTitle" runat="server" Text="Event Booking"></asp:Label>
                        </div>
                        <div class="StepSubHeading"><asp:Label ID="lblFormSubTitle" runat="server" Text="Give few personal information to submit your booking."></asp:Label></div>
                    </div>
                    <div class="StepBody">
                        <div id="divEventSaveMessage" style="margin-bottom:10px; display:none;"></div>
                        <div id="divEventSaveLoading" style="margin-bottom:10px; display:none; font-weight:bold;" >
                            <img src="/Images/Loading.gif" alt="" title=""/>
                        </div>
                        <table cellpadding="3" cellspacing="0" style="width:100%;">
                            <colgroup>
                                <col style="width:15%;" />
                                <col style="width:35%;" />                    
                                <col style="width:15%;" />                
                                <col style="width:35%;" />                                        
                            </colgroup>				    
				            <tr>
                                <td>Name<span class="requiredMark">*</span></td>
					            <td>
						            <asp:TextBox ID="txtName" MaxLength="50" runat="server"></asp:TextBox>
						            <asp:RequiredFieldValidator ID="rfvName" runat="server"
							            ControlToValidate="txtName" SetFocusOnError="true"
							            ErrorMessage="Please Enter your Name." Display="Dynamic"
							            ValidationGroup="SaveInfo">
						            </asp:RequiredFieldValidator>
					            </td>
					            <td>Email<span class="requiredMark">*</span></td>
					            <td>
						            <asp:TextBox ID="txtEmail" MaxLength="50" runat="server"></asp:TextBox>
						            <asp:RequiredFieldValidator ID="rfvEmail" runat="server"
							            ControlToValidate="txtEmail" SetFocusOnError="true"
							            ErrorMessage="Please Enter an Email." Display="Dynamic"
							            ValidationGroup="SaveInfo">
						            </asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                        ControlToValidate="txtEmail" Display="Dynamic" SetFocusOnError="true"
                                        ErrorMessage="Please enter a valid Email address."
                                        ValidationGroup="SaveInfo">
                                    </asp:RegularExpressionValidator>
					            </td>					            
				            </tr>
				            <tr>
					            <td>Address<span class="requiredMark">*</span></td>
					            <td>
						            <asp:TextBox ID="txtAddress" MaxLength="50" runat="server"></asp:TextBox>
						            <asp:RequiredFieldValidator ID="rfvAddress" runat="server"
							            ControlToValidate="txtAddress" SetFocusOnError="true"
							            ErrorMessage="Please Enter your Address." Display="Dynamic"
							            ValidationGroup="SaveInfo">
						            </asp:RequiredFieldValidator>
					            </td>
					            <td>Contact No<span class="requiredMark">*</span></td>
					            <td>
						            <asp:TextBox ID="txtContactNo" MaxLength="50" runat="server"></asp:TextBox>
						            <asp:RequiredFieldValidator ID="rfvContactNo" runat="server"
							            ControlToValidate="txtContactNo" SetFocusOnError="true"
							            ErrorMessage="Please Enter your Contact No." Display="Dynamic"
							            ValidationGroup="SaveInfo">
						            </asp:RequiredFieldValidator>
					            </td>
				            </tr>                    
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="PopupButtonContainer">   
            <input type="button" value="Submit" class="ButtonCommon" id="btnSave" onclick="SaveEventBooking();" />                     
            <input type="button" value="Close" class="ButtonInActive" onclick="HideModalPopup();" />            
        </div>
    </div>
    <%--Modal Event Booking Form End--%>
</asp:Content>


